package com.htandroid.htandroid.webservice;


import com.htandroid.htandroid.entity.MrqgdDjList;
import com.htandroid.htandroid.sys.Basenvo;

import java.util.ArrayList;

//生成xml的文本信息
public class BuildQgdListXMLService {

    public String buildXML(ArrayList<MrqgdDjList> mrqgdlist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (mrqgdlist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < mrqgdlist.size(); i++) {
                MrqgdDjList mrqgd = mrqgdlist.get(i);
                xmlstring = xmlstring + "<MrqgdDjList xmlns=\"http://entity.test.com\">\r\n";
                xmlstring = xmlstring + "<ids>" + Basenvo.AdjDigest(mrqgd.getIds()) + "</ids>\r\n";
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(mrqgd.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<cDepcode>" + Basenvo.AdjDigest(mrqgd.getcDepcode()) + "</cDepcode>\r\n";
                xmlstring = xmlstring + "<cdepname>" + Basenvo.AdjDigest(mrqgd.getCdepname()) + "</cdepname>\r\n";
                xmlstring = xmlstring + "<cInvcCode>" + Basenvo.AdjDigest(mrqgd.getcInvcCode()) + "</cInvcCode>\r\n";
                xmlstring = xmlstring + "<cInvcName>" + Basenvo.AdjDigest(mrqgd.getcInvcName()) + "</cInvcName>\r\n";
                xmlstring = xmlstring + "<cInvcode>" + Basenvo.AdjDigest(mrqgd.getcInvcode()) + "</cInvcode>\r\n";
                xmlstring = xmlstring + "<cInvname>" + Basenvo.AdjDigest(mrqgd.getcInvname()) + "</cInvname>\r\n";
                xmlstring = xmlstring + "<cInvstd>" + Basenvo.AdjDigest(mrqgd.getcInvstd()) + "</cInvstd>\r\n";
                xmlstring = xmlstring + "<cInvm_unit>" + Basenvo.AdjDigest(mrqgd.getcInvm_unit()) + "</cInvm_unit>\r\n";
                xmlstring = xmlstring + "<iQuantity>" + Basenvo.AdjDigest(mrqgd.getiQuantity()) + "</iQuantity>\r\n";
                xmlstring = xmlstring + "<iprice>" + Basenvo.AdjDigest(mrqgd.getIprice()) + "</iprice>\r\n";
                xmlstring = xmlstring + "<iamount>" + Basenvo.AdjDigest(mrqgd.getIamount()) + "</iamount>\r\n";
                xmlstring = xmlstring + "<cvencode>" + Basenvo.AdjDigest(mrqgd.getCvencode()) + "</cvencode>\r\n";
                xmlstring = xmlstring + "<cvenname>" + Basenvo.AdjDigest(mrqgd.getCvenname()) + "</cvenname>\r\n";
                xmlstring = xmlstring + "<cventel>" + Basenvo.AdjDigest(mrqgd.getCventel()) + "</cventel>\r\n";
                xmlstring = xmlstring + "<dDhDate>" + Basenvo.AdjDigest(mrqgd.getdDhDate()) + "</dDhDate>\r\n";
                xmlstring = xmlstring + "<binvtype>" + Basenvo.AdjDigest(mrqgd.getBinvtype()) + "</binvtype>\r\n";
                xmlstring = xmlstring + "<djtype>" + Basenvo.AdjDigest(mrqgd.getDjtype()) + "</djtype>\r\n";
                xmlstring = xmlstring + "<djcvencode>" + Basenvo.AdjDigest(mrqgd.getDjcvencode()) + "</djcvencode>\r\n";
                xmlstring = xmlstring + "<djprice>" + Basenvo.AdjDigest(mrqgd.getDjprice()) + "</djprice>\r\n";
                xmlstring = xmlstring + "<cmemo>" + Basenvo.AdjDigest(mrqgd.getCmemo()) + "</cmemo>\r\n";
                xmlstring = xmlstring + "<canupdjxy>" + Basenvo.AdjDigest(mrqgd.getCanupdjxy()) + "</canupdjxy>\r\n";
                xmlstring = xmlstring + "<dDate>" + Basenvo.AdjDigest(mrqgd.getdDate()) + "</dDate>\r\n";
                xmlstring = xmlstring + "<bchecked>" + Basenvo.AdjDigest(mrqgd.getBchecked()) + "</bchecked>\r\n";
                xmlstring = xmlstring + "</MrqgdDjList>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
